<template>
  <div>
    <detail-banner
      :gallaryImgs="gallaryImgs"
      :bannerImg="bannerImg"
      :sightName="sightName"></detail-banner>
    <detail-header></detail-header>
    <div class="content">
      <detail-list :list="categoryList"></detail-list>
    </div>
  </div>
</template>

<script>
  import DetailBanner from './components/Banner'
  import DetailHeader from './components/Header'
  import DetailList from './components/List'
  import axios from 'axios'

  export default {
    name: 'Detail',
    data () {
      return {
        sightName: '',
        gallaryImgs: [],
        categoryList: [],
        bannerImg: '',
        list: [
          {
            title: '成人票'
            , children: [
              {
                title: '成人三联票',
                children: [
                  {
                    title: 'A店销售'
                  }, {
                    title: 'B店销售'
                  }
                ]
              }, {
                title: '成人三联票'
              }
            ]
          },
          {title: '学生票'},
          {title: '儿童'}
        ]
      }
    },
    components: {
      DetailBanner, DetailHeader, DetailList
    },
    methods: {
      getDetailInfo: function () {
        axios.get('/api/detail.json', {
          params: {
            id: this.$route.params.id
          }
        }).then(this.handleGetData)
      }, handleGetData: function (res) {
        res = res.data
        if (res.ret && res.data) {
          const data = res.data
          console.log(data)
          this.sightName = data.sightName;
          this.gallaryImgs = data.gallaryImgs;
          this.categoryList = data.categoryList;
          this.bannerImg = data.bannerImg;
        }
      }
    },
    mounted () {
      this.getDetailInfo()
    },
    activated () {
    },

  }
</script>

<style scoped lang="stylus">
  .content
    height 50rem
</style>
